﻿using MediatR;
using Rswl.Common.Core;
using Rswl.Common.Core.User.Aggregate.Entities;
using Rswl.Common.Core.User.Events;

namespace Rswl.Common.Application.User.Events
{
    class QueryUserInfoEventHandler:IRequestHandler<QueryUserInfoEvent,UserInfo>
    {
        IUserRepository userRepository;
        public QueryUserInfoEventHandler(IUserRepository _userRepository)
        {
            userRepository = _userRepository;
        }

        public async Task<UserInfo> Handle(QueryUserInfoEvent request, CancellationToken cancellationToken)
        {
            var user = await userRepository.GetUserInfoAsync(request.UserId);
            return user;
        }
    }
}
